# OCR 识别： https://blog.csdn.net/weixin_43612602/article/details/135317269
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By

# 自定义识别加载谷歌浏览器
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))

driver.maximize_window()

# 打开网址
driver.get('https://baijiahao.baidu.com/s?id=1747084742275162539&wfr=spider&for=pc')

img = driver.find_element(By.XPATH, '//*[@id="ssr-content"]/div[2]/div[1]/div[1]/div[2]/div[1]/div[3]/div/img')
img.screenshot("./screenshot.png") # 截图


# OCR识别
# while driver.current_url=='login':
#     # 如果登录失败，继续识别的操作
#     pass


time.sleep(100)
driver.quit()